﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

namespace DesignLife
{
    public partial class ServicesDetail : System.Web.UI.Page
    {
        SqlConnection con = new SqlConnection();
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = 0;
            if (Request["id"]==null)
                Response.Redirect("Services.aspx");
            else
            {
                try
                {
                    id = Convert.ToInt32(Request["id"].ToString());
                }
                catch {
                    Response.Redirect("Services.aspx");
                }
            }
            DataTable tbNews = new DataTable();
            con.ConnectionString = ConfigurationManager.ConnectionStrings["Design_LifeConnection"].ConnectionString;
            con.Open();
            SqlCommand com = new SqlCommand("select CategoryName, Img1, contents from News N inner join Categories C on N.IDCategory = C.CategoryID where NewsID='"+id+"' and N.Status=1", con);
            tbNews.Load(com.ExecuteReader());
            servicesdetail_right_item.DataSource = tbNews;
            servicesdetail_right_item.DataBind();
        }
    }
}